/**
 * 
 */
package robot;

import javax.vecmath.Point2d;
import javax.vecmath.Vector3d;

import program.MovingObjects;


/**
 * Moves in only after direction
 * @date 8 maj 2012
 * @version 1.0
 */
public class SimpleRobot extends Robot {
	private int pathIndex = 0;
	private Point2d[] path;

	/**
	 * @param position start
	 * @param name
	 * @param mo
	 */
	public SimpleRobot(Vector3d position, String name,
			MovingObjects mo) {
		super(position, name, mo);		
		path = new Point2d[] {new Point2d(2,0)};
	}

	/* (non-Javadoc)
	 * @see program.Robot#performBehavior()
	 */
	@Override
	public void performBehavior() {
		updateRoboMap();
		rotateTowardsNextGoal(this.path[pathIndex]);
		setTranslationalVelocity(1);
		    
	    if (this.getCurrentPosition().distance(this.path[pathIndex]) < 0.1) {
	    	pathIndex = (pathIndex + 1) % path.length;
            rotateTowardsNextGoal(path[pathIndex]);
	    }
	}

}

